<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ page import="com.ahmedblog.model.*"%>
<%@ page import="com.ahmedblog.database.*"%>
<%@ page import="java.sql.*"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	String name = request.getParameter("name");
	String email = request.getParameter("email");
	if (name != null && email != null) {
		Author au = new Author(name, email);
		//save the author, au object
		
		DBManager database = new DBManager();
		database.connect();
		database.createAuthor(au);
		database.disconnect();
		
	}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>AhmedBlog</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<p>
			<strong>Create Author</strong>
		</p>
		<form method="post" action="CreateAuthor.jsp">
			<table width="503" border="0">
				<tr>
					<td width="149">
						name
					</td>
					<td width="338">
						<label for="name"></label>
						<input type="text" name="name" id="name">
					</td>
				</tr>
				<tr>
					<td>
						email
					</td>
					<td>
						<label for="email"></label>
						<input type="text" name="email" id="email">
					</td>
				</tr>
			</table>
			<input type="submit" name="submit" id="submit" value="Submit">
		</form>
	</body>

</html>
